<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>Phonon.Path Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">Phonon.Path Class Reference<br /><sup><sup>[<a href="phonon.html">phonon</a> module]</sup></sup></h1><p>The Path class describes connections between media nodes.
<a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="phonon-path.html#Path">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="phonon-path.html#Path-2">__init__</a></b> (<i>self</i>, Path)</li><li><div class="fn" />bool <b><a href="phonon-path.html#disconnect">disconnect</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-Phonon.Effect <b><a href="phonon-path.html#effects">effects</a></b> (<i>self</i>)</li><li><div class="fn" />Effect <b><a href="phonon-path.html#insertEffect">insertEffect</a></b> (<i>self</i>, EffectDescription&#160;<i>desc</i>, Effect&#160;<i>before</i>&#160;=&#160;None)</li><li><div class="fn" />bool <b><a href="phonon-path.html#insertEffect-2">insertEffect</a></b> (<i>self</i>, Effect&#160;<i>newEffect</i>, Effect&#160;<i>before</i>&#160;=&#160;None)</li><li><div class="fn" />bool <b><a href="phonon-path.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="phonon-path.html#reconnect">reconnect</a></b> (<i>self</i>, MediaNode&#160;<i>source</i>, MediaNode&#160;<i>sink</i>)</li><li><div class="fn" />bool <b><a href="phonon-path.html#removeEffect">removeEffect</a></b> (<i>self</i>, Effect&#160;<i>effect</i>)</li><li><div class="fn" />MediaNode <b><a href="phonon-path.html#sink">sink</a></b> (<i>self</i>)</li><li><div class="fn" />MediaNode <b><a href="phonon-path.html#source">source</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="phonon-path.html#__eq__">__eq__</a></b> (<i>self</i>, Path&#160;<i>p</i>)</li><li><div class="fn" />bool <b><a href="phonon-path.html#__ne__">__ne__</a></b> (<i>self</i>, Path&#160;<i>p</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The Path class describes connections between media nodes.</p>
<p>In a <a href="phonon-overview.html#building-graphs">media
graph</a>, <a href="phonon-medianode.html">MediaNode</a>s are
connected by Paths. The multimedia travels in streams over these
paths.</p>
<p>You create a path between two media nodes using the static
<a href="phonon-path.html#createPath">Phonon.createPath</a>()
function, which takes two nodes as arguments. The first argument
will send the media stream to the second. Please refer to the class
description of the individual media nodes and the Phonon <a href="phonon-overview.html#phonon-overview">overview</a> to see which
nodes can be connected to each other.</p>
<p>Paths are also used to insert audio <a href="phonon-effect.html">Effect</a>s between two media nodes. The
effect will then alter the stream on the path. Notice that <a href="phonon-effect.html">Effect</a>s also are media nodes, but that
<a href="phonon-path.html#insertEffect">insertEffect</a>() -
instead of <a href="phonon-path.html#createPath">Phonon.createPath</a>() - is used to
insert them into the media graph.</p>
<p>The following code example shows how to create a path between
two media nodes and insert an effect on that path.</p>
<pre class="cpp">
 MediaObject <span class="operator">*</span>media <span class="operator">=</span> <span class="keyword">new</span> MediaObject;
 AudioOutput <span class="operator">*</span>output <span class="operator">=</span> <span class="keyword">new</span> AudioOutput(Phonon<span class="operator">.</span>MusicCategory);
 Path path <span class="operator">=</span> Phonon<span class="operator">.</span>createPath(media<span class="operator">,</span> output);
 Q_ASSERT(path<span class="operator">.</span>isValid()); <span class="comment">// for this simple case the path should always be</span>
                           <span class="comment">//valid - there are unit tests to ensure it</span>
 <span class="comment">// insert an effect</span>
 <span class="type"><a href="qlist.html">QList</a></span><span class="operator">&lt;</span>EffectDescription<span class="operator">&gt;</span> effectList <span class="operator">=</span> BackendCapabilities<span class="operator">.</span>availableAudioEffects();
 <span class="keyword">if</span> (<span class="operator">!</span>effectList<span class="operator">.</span>isEmpty()) {
     Effect <span class="operator">*</span>effect <span class="operator">=</span> path<span class="operator">.</span>insertEffect(effectList<span class="operator">.</span>first());
 }
</pre><hr /><h2>Method Documentation</h2><h3 class="fn"><a name="Path" />Path.__init__ (<i>self</i>)</h3><p>Creates an invalid path.</p>
<p>You can still make it a valid path by calling reconnect. It is
recommended to use the <a href="phonon-path.html#createPath">Phonon.createPath</a>() function to
create paths.</p>
<p><b>See also</b> <a href="phonon-path.html#createPath">Phonon.createPath</a>() and <a href="phonon-path.html#isValid">isValid</a>().</p>


<h3 class="fn"><a name="Path-2" />Path.__init__ (<i>self</i>, <a href="phonon-path.html">Path</a>)</h3><p>Constructs a copy of the other <i>path</i> specified.</p>
<p>This constructor is fast thanks to explicit sharing.</p>


<h3 class="fn"><a name="disconnect" />bool Path.disconnect (<i>self</i>)</h3><p>Tries to disconnect the path from the MediaNodes it is connected
to, returning true if successful or false if unsuccessful.</p>
<p>If successful, the path is invalidated: <a href="phonon-path.html#isValid">isValid</a>() will returns false.</p>


<h3 class="fn"><a name="effects" />list-of-Phonon.Effect Path.effects (<i>self</i>)</h3><p>Returns a list of Effect objects that are currently used as
effects. The order in the list determines the order the signal is
sent through the effects.</p>
<p>Returns A list with all current effects.</p>
<p><b>See also</b> <a href="phonon-path.html#insertEffect">insertEffect</a>() and <a href="phonon-path.html#removeEffect">removeEffect</a>().</p>


<h3 class="fn"><a name="insertEffect" /><a href="phonon-effect.html">Effect</a> Path.insertEffect (<i>self</i>, <a href="phonon-effectdescription.html">EffectDescription</a>&#160;<i>desc</i>, <a href="phonon-effect.html">Effect</a>&#160;<i>before</i>&#160;=&#160;None)</h3><p>Creates and inserts an effect into the path.</p>
<p>You may insert effects of the same class as often as you like,
but if you insert the same object, the call will fail.</p>
<p><i>desc</i> is the <a href="phonon-objectdescription.html#EffectDescription-typedef">EffectDescription</a>
object for the effect to be inserted.</p>
<p>If you already inserted an effect you can tell with
<i>insertBefore</i> in which order the data gets processed. If this
is <tt>0</tt> the effect is appended at the end of the processing
list. If the effect has not been inserted before the method will do
nothing and return <tt>false</tt>.</p>
<p>Returns a pointer to the effect object if it could be inserted
at the specified position. If <tt>0</tt> is returned, the effect
was not inserted.</p>
<p>Below is a code example for inserting an effect into a path:</p>
<pre class="cpp">
     <span class="type"><a href="qlist.html">QList</a></span><span class="operator">&lt;</span>Phonon<span class="operator">.</span>EffectDescription<span class="operator">&gt;</span> effectDescriptions <span class="operator">=</span>
             Phonon<span class="operator">.</span>BackendCapabilities<span class="operator">.</span>availableAudioEffects();
     Phonon<span class="operator">.</span>EffectDescription effectDescription <span class="operator">=</span> effectDescriptions<span class="operator">.</span>at(<span class="number">4</span>);

     Phonon<span class="operator">.</span>Path path <span class="operator">=</span> Phonon<span class="operator">.</span>createPath(mediaObject<span class="operator">,</span> audioOutput);

     Phonon<span class="operator">.</span>Effect <span class="operator">*</span>effect <span class="operator">=</span> <span class="keyword">new</span> Phonon<span class="operator">.</span>Effect(effectDescription);
     path<span class="operator">.</span>insertEffect(effect);
</pre>
<p><b>See also</b> <a href="phonon-path.html#removeEffect">removeEffect</a>() and <a href="phonon-path.html#effects">effects</a>().</p>


<h3 class="fn"><a name="insertEffect-2" />bool Path.insertEffect (<i>self</i>, <a href="phonon-effect.html">Effect</a>&#160;<i>newEffect</i>, <a href="phonon-effect.html">Effect</a>&#160;<i>before</i>&#160;=&#160;None)</h3><p>Inserts the given <i>effect</i> into the path before the effect
specified by <i>insertBefore</i> and returns true if successful;
otherwise returns false.</p>
<p>If <i>insertBefore</i> is zero, the effect is appended to the
processing list.</p>
<p>You may insert effects of the same class as often as you like,
but if you insert the same object, the call will fail.</p>
<p><i>effect</i> will be inserted right before <i>insertBefore</i>.
If <i>insertBefore</i> is <tt>0</tt>, the effect is appended at the
end of the processing list. If the effect has not been inserted
before the method will do nothing and return <tt>false</tt>.</p>
<p>Returns whether the effect could be inserted at the specified
position. If <tt>false</tt> is returned the effect was not
inserted.</p>
<p><b>See also</b> <a href="phonon-path.html#removeEffect">removeEffect</a>() and <a href="phonon-path.html#effects">effects</a>().</p>


<h3 class="fn"><a name="isValid" />bool Path.isValid (<i>self</i>)</h3><p>A path is considered valid if it is connected to two media
nodes, in which case this function returns true. If it is connected
to one or no media nodes, it is consider invalid, and this function
will then return false.</p>


<h3 class="fn"><a name="reconnect" />bool Path.reconnect (<i>self</i>, <a href="phonon-medianode.html">MediaNode</a>&#160;<i>source</i>, <a href="phonon-medianode.html">MediaNode</a>&#160;<i>sink</i>)</h3><p>Changes the media nodes the path is connected to by connecting
the path to the <i>source</i> and <i>sink</i> nodes specified.
Returns true if successful; otherwise returns false.</p>
<p>If unsuccessful, the path remains connected to the same nodes as
before.</p>
<p><b>See also</b> <a href="phonon-path.html#createPath">Phonon.createPath</a>() and <a href="phonon-overview.html#phonon-overview">Phonon Overview</a>.</p>


<h3 class="fn"><a name="removeEffect" />bool Path.removeEffect (<i>self</i>, <a href="phonon-effect.html">Effect</a>&#160;<i>effect</i>)</h3><p>Removes the given <i>effect</i> from the path and returns true;
otherwise returns false.</p>
<p>Removes an <i>effect</i> from the path.</p>
<p>If the effect is deleted while it is still connected, the effect
will be removed automatically.</p>
<p><b>See also</b> <a href="phonon-path.html#insertEffect">insertEffect</a>() and <a href="phonon-path.html#effects">effects</a>().</p>


<h3 class="fn"><a name="sink" /><a href="phonon-medianode.html">MediaNode</a> Path.sink (<i>self</i>)</h3><p>Returns the sink <a href="phonon-medianode.html">MediaNode</a>
used by the path.</p>


<h3 class="fn"><a name="source" /><a href="phonon-medianode.html">MediaNode</a> Path.source (<i>self</i>)</h3><p>Returns the source <a href="phonon-medianode.html">MediaNode</a>
used by the path.</p>


<h3 class="fn"><a name="__eq__" />bool Path.__eq__ (<i>self</i>, <a href="phonon-path.html">Path</a>&#160;<i>p</i>)</h3><h3 class="fn"><a name="__ne__" />bool Path.__ne__ (<i>self</i>, <a href="phonon-path.html">Path</a>&#160;<i>p</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>